home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmigaPlus / Tools / Development / RxMUI / Examples / GroupSort.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2004-01-31  |  3.8 KB  |  119 lines

  1. /**/
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call init
  7. call createApp
  8. call handleApp
  9. /* never reached */
  10. /***********************************************************************/
  11. init: procedure
  12.     l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  13.     if AddLibrary("rexxsupport.library","rxmui.library")~=0 then exit
  14.     return
  15. /***********************************************************************/
  16. handleApp: procedure
  17.     ctrl_C=2**12
  18.     do forever
  19.         call newhandle("APP","H",ctrl_c)
  20.         if and(h.signals,ctrl_c)>0 then exit
  21.         select
  22.             when h.event="QUIT" then exit
  23.             otherwise interpret h.event
  24.         end
  25.     end
  26.     /* never reached */
  27. /***********************************************************************/
  28. createApp: procedure
  29.  
  30.     /* first of all the let's create the menu strip
  31.      * here made only of one item "Project"
  32.      */
  33.     strip.0="mproject"
  34.      mproject.Title="Project"
  35.      mproject.class="menu"
  36.       mproject.0=menuitem("mabout","About...","?")
  37.       mproject.1=menuitem("maboutrxmui","About RxMUI...")
  38.       mproject.2=menuitem("maboutmui","About MUI...")
  39.       mproject.3=menuitem("","BAR")
  40.       mproject.4=menuitem("mhide","Hide","H")
  41.       mproject.5=menuitem("","BAR")
  42.       mproject.6=menuitem("mquit","Quit","Q")
  43.     res=NewObj("menustrip","strip")
  44.     if res~=0 then call err(res)
  45.  
  46.     /* with one NewObj() call we create many objects */
  47.  
  48.     /* first of all the let's define the application object */
  49.     app.Title="GroupSort"
  50.     app.Version="$VER: GroupSort 1.0 (15.1.2002)"
  51.     app.Copyright="Copyright 1999-2002 Alfonso Ranieri"
  52.     app.Author="Alfonso Ranieri"
  53.     app.Description="Group sort example"
  54.     app.Base="GROUPSORT"
  55.     app.menustrip="strip"
  56.     app.subwindow="win"
  57.  
  58.      /* let's define the window */
  59.      win.ID="MAIN"
  60.      win.Title=app.Description
  61.      win.Contents="mgroup"
  62.  
  63.       /* let's define the window contents */
  64.       mgroup.0="g"
  65.        g.class="group"
  66.        g.frame="group"
  67.        g.background="groupback"
  68.         do i=0 to 9
  69.             g.i="g." || i
  70.              g.i.class="group"
  71.              g.i.horiz=1
  72.               g.i.0=hspace()
  73.               g.i.1=label("Checkmark _" || i)
  74.               g.i.2=CheckMark("c" || i,,i)
  75.               g.i.3=hspace()
  76.         end
  77.  
  78.       mgroup.1="bg"
  79.        bg.class="group"
  80.        bg.horiz=1
  81.          ascend.disabled=1
  82.         bg.0=button("Ascend","_Ascend")
  83.         bg.1=button("Descend","_Descend")
  84.  
  85.     call NewObj("Application","app")
  86.  
  87.     call Notify("mabout","menutrigger","Everytime","app","about","win")
  88.     call Notify("maboutrxmui","menutrigger","everytime","app","aboutrxmui","win")
  89.     call Notify("maboutmui","menutrigger","everytime","app","aboutmui","win")
  90.     call Notify("mhide","menutrigger","everytime","app","set","iconified",1)
  91.     call Notify("mquit","menutrigger","everytime","app","returnid","quit")
  92.     call Notify("win","closerequest","Everytime","app","returnid","quit")
  93.     call Notify("ascend","pressed",0,"ascend","set","disabled",1)
  94.     call Notify("ascend","pressed",0,"descend","set","disabled",0)
  95.     call Notify("ascend","pressed",0,"app","return","call order(0)")
  96.     call Notify("descend","pressed",0,"descend","set","disabled",1)
  97.     call Notify("descend","pressed",0,"ascend","set","disabled",0)
  98.     call Notify("descend","pressed",0,"app","return","call order(1)")
  99.  
  100.     call set("win","open",1)
  101.     return
  102. /***********************************************************************/
  103. halt:
  104. break_c:
  105.     exit
  106. /**************************************************************************/
  107. /* Note that not all objects, like in this example
  108. ** have to be specified
  109. */
  110. order: procedure
  111. parse arg descend
  112.     do i=0 to 9
  113.         if descend then sort.i="g." || 9-i
  114.         else sort.i="g." || i
  115.     end
  116.     call DoMethod("g","SortStem","sort")
  117.     return
  118. /**************************************************************************/
  119.